﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace PuzzleCoop
{
    public class EffectsManager
    {
             List<Effect> effects;

        public EffectsManager()
        {
            effects = new List<Effect>();
        }

        public void Update(GameTime gameTime)
        {
            for (int i = 0; i < effects.Count; ++i)
            {
                if (effects[i].alive) effects[i].Update(gameTime);
                else effects.Remove(effects[i]);
            }
        }

        public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            foreach (Effect e in effects) e.Draw(gameTime, spriteBatch);
        }

        public void Add(Effect e)
        {
            effects.Add(e);
        }
    }
}
